package utils

import "time"

const (
	TIME_NIL         = "0001-01-01"
	TIME_FMT_FULL    = "2006-01-02 15:04:05"
	TIME_FMT_FULL2   = "20060102150405"
	TIME_FMT_YMD     = "2006-01-02"
	TIME_FMT_YMD_000 = "2006-01-02 00:00:00"
	TIME_FMT_Y       = "2006"
	TIME_FMT_MD      = "01-02"
	TIME_FMT_HM      = "15:04"
)

func ConvtStrToTime(str, format string) time.Time {
	t, e := time.ParseInLocation(format, str, time.Local)
	if e != nil {
		return time.Time{}
	}
	return t
}

func ConvtStrToTimePoint(str, format string) *time.Time {
	timeVal := ConvtStrToTime(str, format)
	return &timeVal
}

func ConvtTimeToStr(date time.Time, format string) string {
	return date.Format(format)
}
